home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 4.iso
/
searchtools
/
refjoin
< prev
next >
Wrap
Text File
|
1994-08-01
|
1KB
|
41 lines
#! /bin/sh
#
# ~4Dgifts/toolbox/searchtools/refjoin functions.INDEX sifter/joiner utility
#
# Using the master function-keyword index, functions.INDEX,
# generated by getobjs, print the files containing the keyword(s).
# If more than one arg is given, we use "join" to print only the
# files containing all the keywords. This isn't the most optimal
# algorithm, but for small numbers of keywords, it works
# pretty well.
INDEX=searchtools/functions.INDEX
echo=true
if [ x"$1" = x-v ]; then echo=echo; shift; fi
if [ $# -lt 1 ]
then echo "Usage: $0 keyword1 [ keyword2 ... ]" ; exit 1
fi
if [ $# -eq 1 ]
then exec searchtools/look $1 $INDEX
fi
keywords="$@"
trap "rm -f /tmp/rj*.$$" 0 1 15
searchtools/look $1 $INDEX > /tmp/rj.$$
shift
filefield=2
while [ $# -ge 1 ]
do
searchtools/look $1 $INDEX > /tmp/rj2.$$
join -j1 $filefield -j2 2 /tmp/rj.$$ /tmp/rj2.$$ > /tmp/rjj.$$
filefield=1
mv /tmp/rjj.$$ /tmp/rj.$$
shift
done
$echo Files that contain the keywords: "$keywords"
sed -e 's/^/ /' -e 's/ .*//' /tmp/rj.$$